export type MaybeUndefine<T> = T | undefined;

/** 数值类㻫 */
export type NumberKind = "u8" | "u16" | "u32" | "u64" | "i8" | "i16" | "i32" | "i64" | "f32" | "f64";

export const DATA_TYPE_LENGTH_MAP: { [k in NumberKind]: number } = {
    u8: 1,
    u16: 2,
    u32: 4,
    u64: 8,
    i8: 1,
    i16: 2,
    i32: 4,
    i64: 8,
    f32: 4,
    f64: 8,
};

export function isNumberKind(kind: string): kind is NumberKind {
    return kind in DATA_TYPE_LENGTH_MAP;
}
